package dingcan;
import java.util.Scanner;
//继承和实现接口
public class Indent extends Menu implements Order {
    private int copies;         //点餐份数
    private int time;           //送餐时间
    private double AllPrice;    //订餐总价
    @Override
    public void DianCan() {
        int j;
        int i;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的姓名:");
        for (j = 0;j<File.person.length;j++){
            if (File.person[j].getUserName()==null){
                File.person[j].setUserName(sc.next());
                System.out.println("请选择你要点的餐:");
                setNumber(sc.nextInt());
                for (i=0;i< File.menu.length;i++){
                    if (getNumber() == File.menu[i].getNumber()){
                        setDishName(File.menu[i].getDishName());
                        File.person[j].setUserCaiName(getDishName());
                        break;
                    }
                }
                System.out.println("请选择你要份数:");
                setCopies(sc.nextInt());
                File.person[j].setUserCaiNum(getCopies());

                System.out.println("请选择送餐时间:");
                setTime(sc.nextInt());
                File.person[j].setUserTime(getTime());

                System.out.println("请输入送餐地址:");
                File.person[j].setUserAddress(sc.next());

                setAllPrice(File.menu[i].getPrice()*getCopies());
                File.person[j].setUserAllPrice(getAllPrice());

                break;
            }

        }

        System.out.println("你的订单信息如下:");
        System.out.println("点餐人"+"\t"+"菜名"+"\t"+"份数"
                +"\t"+"总价"+"\t"+"送餐时间"+"\t"+"送餐地址");
        System.out.println(File.person[j].getUserName()+"\t"+File.person[j].getUserCaiName()
                +"\t"+File.person[j].getUserCaiNum() +"\t"+File.person[j].getUserAllPrice()+"\t"
                +File.person[j].getUserTime()+"\t"+File.person[j].getUserAddress());

        System.out.println();
    }

    public int getCopies() {
        return copies;
    }

    public void setCopies(int copies) {
        this.copies = copies;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public double getAllPrice() {
        return AllPrice;
    }

    public void setAllPrice(double allPrice) {
        AllPrice = allPrice;
    }
}



